#!/bin/bash

cp /etc/hosts /etc/hosts.bak
echo "151.101.76.133      raw.githubusercontent.com" >> /etc/hosts
mkdir ~/.pip
cp ./pip.conf ~/.pip
export ROS_OS_OVERRIDE=centos:7.6
dnf install python2-sip-devel llvm  pcl-devel yum -y
pip install rosdep wstool rosinstall_generator
rosdep init
# mv /etc/ros/rosdep/base-openeuler.yaml /etc/ros/rosdep/base-openeuler.yaml.bak
cp ~/base-openeuler.yaml /etc/ros/rosdep/base-openeuler.yaml
echo "yaml file:///etc/ros/rosdep/base-openeuler.yaml" > /etc/ros/rosdep/sources.list.d/10-openeuler.list
rosdep update
rosinstall_generator desktop_full --rosdistro melodic --deps --tar > melodic-desktop-full.rosinstall
wstool init -j8 src melodic-desktop-full.rosinstall
rosdep install --from-paths src --ignore-src --rosdistro melodic -y -r
pip install numpy
pip install matplotlib empy netifaces pycryptodomex defusedxml pydot PyOpenGL
dnf remove tinyxml -y
dnf install tinyxml-devel poco-devel opencv-devel opencv-python eigen3-devel sbcl urdfdom-devel hddtemp log4cxx-devel -y
dnf install boost-python2-devel -y 
dnf groupinstall "Development Tools" -y
ln -s /usr/include/eigen3/Eigen /usr/include/Eigen
cp /usr/lib64/pkgconfig/yaml-cpp-dynamic.pc /usr/lib64/pkgconfig/yaml-cpp.pc
mv /usr/include/tinystr.h /usr/include/tinystr.h.bak
mv ./tinystr.h /usr/include/tinystr.h
./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release -DCATKIN_ENABLE_TESTING=0 --ignore-pkg rviz librviz_tutorial rqt_rviz rviz_plugin_tutorials rviz_python_tutorial gazebo_ros gazebo_plugins gazebo_ros_control qt_gui_cpp rqt_gui_cpp rqt_image_view pcl_ros
#./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release -DCATKIN_ENABLE_TESTING=0 
